package com.yshkj.payment.entity;

import javax.persistence.*;

/**
 * 用户账号实体
 * 用户和账号为:一个用户拥有多个账号
 * 账号权限为:角色权限+账号权限
 * Created by 唐旭 on 2016/9/7.
 */
@Entity
@Table
@DiscriminatorValue("UserAccount")
public class UserAccount extends Account {

    //reflection field
    //所属用户
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "user")
    private User user;

    public UserAccount() {
    }

    public UserAccount(User user) {
        this.user = user;
    }

    public User getUser() {
        return user;
    }

    public UserAccount setUser(User user) {
        this.user = user;
        return this;
    }

    @Override
    public UserInfo getUserInfo() {
        return user;
    }
}
